package com.societyGames.catExercises
{
	import com.greensock.TweenNano;
	import com.societyGames.action.Action;
	
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	
	public class BuyMittenAction extends Action
	{
		private var _cat:DisplayObjectContainer;
		private var _mitten:DisplayObject;
		private const _duration:Number = .25; 
		
		public function BuyHatAction(cat:DisplayObjectContainer, hat:DisplayObject)
		{
			this._cat = cat;
			this._mitten = hat;
		}
		
		public override function startAction():void
		{
			this._cat.addChild(this._mitten);
			this._mitten.alpha = 0;
			TweenNano.to(this._mitten, _duration, {alpha:1, onComplete:onComplete});	
		}
		
		private function onComplete():void
		{
			this._completeEventObject.dispatchEvent();
		}
	}
}